home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16989 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.8 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c++,comp.lang.c,comp.os.ms-windows.programmer.misc
  4. Subject: Re: fastest code
  5. Date: Fri, 12 Apr 96 23:42:15 GMT
  6. Organization: none
  7. Message-ID: <829352535snz@genesis.demon.co.uk>
  8. References: <316112A2.7D37@public.sta.net.cn> <4kgu7g$n9a@solutions.solon.com> <4kh2p7INNkcq@keats.ugrad.cs.ubc.ca> <4kjdus$fiq@samba.rahul.net> <4kjpn0INN817@keats.ugrad.cs.ubc.ca>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4kjpn0INN817@keats.ugrad.cs.ubc.ca>
  15.            c2a192@ugrad.cs.ubc.ca "Kazimir Kylheku" writes:
  16.  
  17. >In article <4kjdus$fiq@samba.rahul.net>,
  18. >Oliver Hellwig  <hellwig@rahul.net> wrote:
  19. > >Well it did!  I did not turn on full optimizations but I just used the
  20. > >compiler in it's default mode.  However, when I turned off all optimizations
  21. > >then it compiled correctly.  I verified that it left the loop but removed
  22. >
  23. >Ah well. What can be said? Don't use Watcom to compile Linux drivers or any
  24. >other portion. Use a freeware compiler that works.
  25.  
  26. Not to mention that the gcc version of that compiled code, in addition to
  27. working, looks better optimised. What I did find curious was that on
  28. the compilers I tried:
  29.  
  30.     prom[i] = prom[i+i];
  31.  
  32. produces different code to:
  33.  
  34.     prom[i] = prom[2*i];
  35.  
  36. where the code for the latter certainly looks more efficient (although
  37. it is difficult to guess the exact instruction timings). I wonder if
  38. Watcom compiles the 2nd version correctly.
  39.  
  40. -- 
  41. -----------------------------------------
  42. Lawrence Kirby | fred@genesis.demon.co.uk
  43. Wilts, England | 70734.126@compuserve.com
  44. -----------------------------------------
  45.